package com.wut.easyexcel.excel;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.wut.easyexcel.annotation.ExcelDropDown;
import com.wut.easyexcel.common.BaseExcel;
import com.wut.easyexcel.common.enums.SexEnum;
import com.wut.easyexcel.config.LocalDateConverter;
import java.time.LocalDate;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 会员
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ExcelIgnoreUnannotated
public class MemberExcel extends BaseExcel {

    private String id;

    @NotBlank(message = "用户名不能为空")
    @ExcelProperty("用户名*")
    private String username;

    private String password;

    @ExcelProperty("昵称")
    private String nickname;

    @ExcelProperty("身份证号*")
    @NotBlank(message = "身份证号不能为空")
    private String idNumber;

    @ExcelProperty(value = "出生日期", converter = LocalDateConverter.class)
    private LocalDate birthday;

    @ExcelProperty("手机号*")
    @NotBlank(message = "手机号不能为空")
    @Pattern(
        regexp = "^$|^\\d+$",
        message = "手机号不合法"
    )
    @Size(max = 11, message = "联系电话长度不合法：最多{max}个字符")
    private String phone;

    @ExcelProperty("性别")
    @ExcelDropDown(type = SexEnum.class, value = {"男", "女"})
    private String sex;

    @ExcelProperty("照片")
    private String photo;
}
